using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using Ltf.MonitorLizard.Forms;

namespace Ltf.MonitorLizard
{
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.g
		/// </summary>
		[STAThread]
		static void Main()
		{
			Application.EnableVisualStyles();


			string[] args = Environment.GetCommandLineArgs();

            if (args.Length == 1)
            {

                Application.Run(new TwoWayDiff(new string[] { "", "" }, null));
                return;
            }

			if (args[1] == "/merge" && (args.Length==5 || args.Length==6))
			{
				// the next line is useful if you need to pause to attach a debugger
				//MessageBox.Show(string.Format("args:{0}, {1}", args.Length, string.Join(", ", args)));

			//	new Lizard(ServerFunctions.RemoteEventRaiser, true);

				if (args.Length == 5)
				{
					Application.Run(new ThreeWayDiff(args[4], args[2], args[3]));
				}
				else
				{
					Application.Run(new ThreeWayDiff(args[4], args[2], args[3], args[5]));
				}
			}

			else if (args[1] == "/diff" && args.Length == 4)
			{
				// the next line is useful if you need to pause to attach a debugger
		//		MessageBox.Show(string.Format("args:{0}, {1}", args.Length, string.Join(", ", args)));

			//	new Lizard(ServerFunctions.RemoteEventRaiser, true);

				Application.Run(new TwoWayDiff(new string[] { args[2], args[3] }, null));
			}

			else if (args[1] == "/bindiff" && args.Length == 4)
			{
				// the next line is useful if you need to pause to attach a debugger
				//		MessageBox.Show(string.Format("args:{0}, {1}", args.Length, string.Join(", ", args)));

			//	new Lizard(ServerFunctions.RemoteEventRaiser, true);

				Application.Run(new ExecutableDiff(args[2], args[3]));
			}

			else
            {

				MessageBox.Show(string.Format("Unknown args:{0}, {1}", args.Length, string.Join(", ", args)));
			}

		}
	}
}